export const identityServerBase = 'https://localhost:44301';
export const vueBase = 'http://localhost:8080'

import { UserManager } from 'oidc-client'
import utils from './utils';

const openIdConnectSettings = {
    authority: `${identityServerBase}`,
    client_id: `vue-client`,
    redirect_uri: `${vueBase}/#/callback#`,// 表示重定向URI，认证服务器回调的客户端页面。可选项
    post_logout_redirect_uri: `${vueBase}`,
    // silent_redirect_uri: `${vueBase}/#/redirect-silentrenew`,
    scope: 'openid profile offline_access PublicWebSiteGateway', // 表示申请的权限范围，可选项
    response_type: `id_token token`,
    automaticSilentRenew: true,
    filterProtocolClaims: true,
    loadUserInfo: true
};

const userManager = new UserManager(openIdConnectSettings);
userManager.events.addUserSignedOut(async () => {
    utils.removeTokenInfo()
    await userManager.signoutRedirect();
})
export default userManager;